<template>
  <div class="app-container">
    <eHeader :param-bean="paramBean" :sup_this="sup_this" />
    <eForm ref="form" :sup_this="sup_this" />
    <!--表格渲染-->
    <DataGridTable
      v-loading="loading"
      ref="mainTable"
      :sup_this="sup_this"
      :data="data.rtnList"
      :total="total"
      @selection-change="handleGridSelectionChange">
      <el-table-column prop="jobCode" label="系统编码" >
        <template slot-scope="scope">
          <edit :data="scope.row" :sup_this="sup_this" />
        </template>
      </el-table-column>
      <el-table-column prop="jobName" label="职位名称" />
      <el-table-column label="职位类别" align="center">
        <template slot-scope="scope">
          <div v-for="item in dicts.job_type" :key="item.id">
            <el-tag v-if="scope.row.jobType.toString() === item.dictCode" :type="scope.row.jobType ? '' : 'info'">{{ item.dictName }}</el-tag>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="createDate" label="创建日期">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createDate) }}</span>
        </template>
      </el-table-column>
    </DataGridTable>
  </div>
</template>

<script>
import checkPermission from '@/utils/permission'
import { parseTime } from '@/utils/index'
import eHeader from './module/header'
import edit from './module/edit'
import eForm from './module/form'
import initData from '@/mixins/initData'
import { loadDataUrl } from '@/api/system/sysJob'

export default {
  components: { eHeader, eForm, edit },
  mixins: [initData],
  // 设置数据字典
  dictTypes: ['job_type'],
  data() {
    return {
      delLoading: false,
      sup_this: this
    }
  },
  created() {
    this.url = loadDataUrl()
    this.$nextTick(() => {
      this.init()
    })
  },
  methods: {
    parseTime,
    checkPermission,
    async beforeInit() {
      return true
    }
  }
}
</script>
